<%@ page import="com.cn.domain.Student" %><%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2025/11/3
  Time: 10:31
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<h1>jsp显示</h1>
<%
  Student a = new Student();
  out.println(a.getName());
  out.println(a.getAge());
  out.println(a.getSex());

  a.setName("李四");
  a.setAge(18);
  a.setSex("男");
  out.println(a.getName());
  out.println(a.getAge());
  out.println(a.getSex());
%>

<h1>useBean标签</h1>
实例化：<jsp:useBean id="stu" class="com.cn.domain.Student" scope="page"/><br/>
姓名：<jsp:getProperty name="stu" property="name"/><br/>
年龄：<jsp:getProperty name="stu" property="age"/><br/>
性别：<jsp:getProperty name="stu" property="sex"/><br/>


实例化：<jsp:useBean id="b" class="com.cn.domain.Student" scope="page"/><br/>
姓名：<jsp:setProperty name="b" property="name" value="王五"/><br/>
年龄：<jsp:setProperty name="b" property="age" value="19"/><br/>
性别：<jsp:setProperty name="b" property="sex" value="女"/><br/>
姓名：<jsp:getProperty name="b" property="name"/><br/>
年龄：<jsp:getProperty name="b" property="age"/><br/>
性别：<jsp:getProperty name="b" property="sex"/><br/>


</body>
</html>
